package com.briup.cms.dao;

import com.briup.cms.bean.Article;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ArticleMapper {
    @Select("select * from cms_article")
    List<Article> selectAll();

    @Insert("insert into cms_article values(null,#{title},#{content},#{publishDate},#{readTime},#{thumbUpTimes},#{thumbDownTimes}," +
            "#{status},#{categoryId},#{userId},)")
    void insert(Article article);

    @Update("update cms_article set title=#{title},content=#{content},publishDate=#{publishDate},readTime=#{readTime},thumbUpTimes=#{thumbUpTimes}," +
            "thumbDownTimes=#{thumbDownTimes},status=#{status},categoryId=#{categoryId},userId=#{userId}where id=#{id}")
    void update(Article article);

    @Delete("delete from cms_article where id = #{id}")
    void deleteById(long id);
}
